package com.dongdong.bookstore.common.api;

/**
 * 状态码和描述
 * @author chiangkai
 * @date 2021-10-14
 * @email chiangkk@163.com
 */
public enum ReturnCode implements IReturnCode{
    /**操作成功**/
    RC200(200,"操作成功"),

    RC404(404,"资源路径不存在"),
    /**操作失败**/
    RC999(999,"操作失败"),

    /**服务异常**/
    RC500(500,"系统异常，请稍后重试"),

    NO_TOKEN(2000,"暂未登录或token已经过期"),
    INVALID_TOKEN(2001,"访问令牌不合法"),
    ACCESS_DENIED(2003,"没有权限访问该资源"),
    
    VALIDATE_FAILED(1000, "参数检验失败"),
    CLIENT_AUTHENTICATION_FAILED(1001,"客户端认证失败"),
    USERNAME_OR_PASSWORD_ERROR(1002,"用户名或密码错误"),

    UNSUPPORTED_GRANT_TYPE(1003, "不支持的认证模式");



    /**自定义状态码**/
    private final int code;
    /**自定义描述**/
    private final String message;

    ReturnCode(int code, String message){
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
